
// menu 场景下的 center view
cc.Class({
    extends: cc.Component,

    properties: {
        // 快速开始
        btnQuickStart: {
            type: cc.Button,
            default: null,
        },
        // 进阶场
        btnAdvance: {
            type: cc.Button,
            default: null,
        },
        // 争霸场
        btnTournament: {
            type: cc.Button,
            default: null,
        }

    },
    // 注册点击事件
    onLoad: function() {
        // preload scene
        cc.director.preloadScene('table', function () {
            cc.log('table preloaded');
        })
        // 快速开始
        const clickEventHandler = new cc.Component.EventHandler();
        // 事件处理所在节点
        clickEventHandler.target = this.node;
        // 调用脚本所在文件名
        clickEventHandler.component = 'centerView';
        clickEventHandler.handler = 'quickStart';
        // clickEventHandler.customEventData = '';
        this.btnQuickStart.clickEvents.push(clickEventHandler);
    },

    quickStart: function(event, customEventData) {
        cc.log('quick start on click');
        // const btn = event.target.getComponent(cc.Button);
        cc.director.loadScene('table');
    },

    clickButton: function(event, customEventData) {
        cc.log(`click button ${customEventData}`);
    },

    start () {

    },

    // update (dt) {},
});
